<template>
	<aplid-base-crud
		ref="crud"
		class="w-100"
		:beforeOnLoadFormate="beforeOnLoadFormate"
		:paramsObj="{
			dataType: dataType,
		}"
		v-bind="baseConfig"
	>
		<template v-slot:DetailDialog="{ row, show }">
			<DetailPage :api="baseConfig.api" :key="show" :dataType="dataType" :nowRowData="row"></DetailPage>
		</template>
	</aplid-base-crud>
</template>

<script setup lang="ts">
import { baseConfig } from './config'
import DetailPage from './DetailPage/index.vue'

defineProps({
	dataType: {
		type: [String, Number],
	},
})
const crud = ref()
const beforeOnLoadFormate = (query) => {
	return new Promise((resolve, reject) => {
		let gatherFinishTimeBetween = ''
		if (query.gatherFinishTimeBetween) {
			gatherFinishTimeBetween = query.gatherFinishTimeBetween.join(',')
		}
		resolve({
			...query,
			gatherFinishTimeBetween,
		})
	})
}
</script>

<style scoped></style>
